<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" type="text/css" href="../css/common.css"/>
<link rel="stylesheet" type="text/css" href="../font/iconfont.css"/>
<style type="text/css">
.juser-banner{
	height: auto;
	position: relative;
	background: -webkit-gradient(linear, 0 0, 0 100%, from(#5097FF), to(#68D5FE));
}
.juser-inner{
	padding: 1.5rem 0 2rem 0;
}
.juser-icon{
	width:5rem;
	height: 5rem;
	border-radius: 7rem;
	margin: auto;
	margin-top: 1.5rem;
	overflow: hidden;
}
.juser-txt{
	text-align:center;
	color: #fff;
	padding-top:1rem;
}
.gerenbg{
	position:fixed;
	width: 100%;
	left: 0;
	bottom: 0;
	font-size: 0;
}
.juser-zhucetime{
	text-align: center;
	font-size:14px;
	color: #eee;
	padding-top:5px;
}
.ulform{
	margin: 0;
	padding: 0;
}
.ulform-li{
	display: flex;
	display: -webkit-flex;
	background: #fff;
	position: relative;
	height:3.9rem;
}
.ulform-rli{
	flex: 1;
	-webkit-flex: 1;
	text-align: right;
}
.ulfrom-c{
	flex: 1;
	-webkit-flex: 1;
}
select{
	border: 0;
	background: transparent;
	appearance:none;
	-webkit-appearance:none; /* Safari 和 Chrome */
	direction: rtl;
}
select:focus{
	outline: none;
}
option{
	direction: ltr;
}
.ulform-label{
	color: #888;
}
.ulform-rli-input{
	display: block;
	height: 100%;
	border: 0;
	padding-right:5px;
}
.licon{
	padding-right:1rem;
	color: dodgerblue;
	width: 50px;
	text-align:right;
	font-size: 20px;
}
.ulfrom-li-ricon{
	width: 30px;
	text-align: center;
	color: #999;
}
.splitline{
	height: 10px;
}
</style>
</head>
<body>
<div id="jcontent" class="jcontent">
	
	<div class="juser-banner">
		<div id="userinfos" class="juser-inner">
			<div class="juser-icon">
				<img id="headImg" src="../img/zw.png" class="img"/>
			</div>
			<div id="userName" class="juser-txt">-</div>
			<div id="regDate" class="juser-zhucetime">
				-
			</div>
		</div>
	</div>
	<div class="splitline"></div>
	
	<ul id="ulform" class="ulform">
		<li class="ulform-li line-b vcenter">
			<i class="iconfont icon-tz licon"></i>
			<span class="ulform-label">消息通知</span>
			<select id="vehicle-model" class="ulform-rli">
				<option id="gender_1" value="1">开启</option>
				<option id="gender_2" value="0">关闭</option>
			</select>
			<div class="ulfrom-li-ricon"><i class="iconfont icon-i6"></i></div>
		</li>
		<li class="ulform-li line-b b3 vcenter">
			<i class="iconfont icon-ql licon"></i>
			<span class="ulform-label">清理缓存</span>
			<div class="ulfrom-c"></div>
			<div class="ulfrom-li-ricon"><i class="iconfont icon-i6"></i></div>
		</li>
		<li class="ulform-li line-b b2 vcenter">
			<i class="iconfont icon-gy licon"></i>
			<span class="ulform-label">关于我们</span>
			<div class="ulfrom-c"></div>
			<div class="ulfrom-li-ricon"><i class="iconfont icon-i6"></i></div>
		</li>
		<li class="ulform-li line-b b1 vcenter">
			<i class="iconfont icon-tc licon"></i>
			<span class="ulform-label">退出登录</span>
			<div class="ulfrom-c"></div>
			<div class="ulfrom-li-ricon"><i class="iconfont icon-i6"></i></div>
		</li>
	</ul>
</div>
<script src="../js/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/common.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/template.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
mui.plusReady(function(){
	window.setTimeout(function(){
		getUserInfo();
	},360);
});
mui('#ulform').on('tap','.ulform-li', function() {
	var _classList=this.classList;
	if(_classList.contains("b1")){
		//退出登录
		logOut();
	}else if (_classList.contains("b2")){
		mui.toast("车生活 V1.0");
	}else if (_classList.contains("b3")){
		mui.toast("清除缓存成功！");
	}
});

function logOut(){
	plus.nativeUI.confirm( "确定要退出登录?", function(e){
		if(e.index==0){
			//清除缓存
			window.localStorage.removeItem(webapp.config.TOKEN);
			window.localStorage.removeItem(webapp.config.CACHE_USER);
			document.getElementById("regDate").innerHTML="";
			document.getElementById("userName").innerHTML="未登陆"
			mui.toast("已退出登录");
		}
	}, "退出登录", ["是的","取消"] );
	
}

/**
 * 获取用户信息
 */
function getUserInfo(){
    webapp.ajax({
        url:"/carLife/admin/interface/carOwner/selectCarOwnerMessage",
        success:function(json){
            webapp.debug(json);
            var user=json.data;
            document.getElementById("regDate").innerHTML=webapp.util.dateFormat(user.createTime,"yyyy年MM月dd日注册");
            if(webapp.util.isNotNull(user.nickName)){
            	document.getElementById("userName").innerHTML=user.nickName;
            }else{
            	document.getElementById("userName").innerHTML=user.accountName; 
            }
            if(user.headPortrait){
            	document.getElementById("headImg").setAttribute("src",webapp.config.restUrl+user.headPortrait);
            }
        }
    });
}
</script>
</body>
</html>
